/// @file ui_ao.h
/// @brief User Interface Active Object for the authentication system
///
/// This file defines the UiAo class which handles user interface interactions
/// and communicates with the AuthAo through events.

#ifndef UI_AO_H
#define UI_AO_H

#include "qpcpp.hpp"
#include "auth_events.h"

/// @class UiAo
/// @brief User Interface Active Object
///
/// This class handles user interface interactions and communicates with the
/// AuthAo through events. It processes UI events and forwards authentication
/// requests to the AuthAo.
class UiAo : public QP::QActive
{
public:
    /// @brief Constructor
    UiAo();

protected:
    /// @brief Initial state handler
    Q_STATE_DECL(initial);

    /// @brief Processing state handler
    Q_STATE_DECL(processing);

    /// @brief Handling state for login response
    Q_STATE_DECL(handlingLoginResponse);

    /// @brief Handling state for register response
    Q_STATE_DECL(handlingRegisterResponse);

    /// @brief Handling state for logout response
    Q_STATE_DECL(handlingLogoutResponse);

    /// @brief Handling state for session check response
    Q_STATE_DECL(handlingSessionCheckResponse);

private:
    // State handler methods
    static QP::QState initial(UiAo* const me, QP::QEvt const* const e);
    static QP::QState processing(UiAo* const me, QP::QEvt const* const e);
    static QP::QState handlingLoginResponse(UiAo* const me, QP::QEvt const* const e);
    static QP::QState handlingRegisterResponse(UiAo* const me, QP::QEvt const* const e);
    static QP::QState handlingLogoutResponse(UiAo* const me, QP::QEvt const* const e);
    static QP::QState handlingSessionCheckResponse(UiAo* const me, QP::QEvt const* const e);
};

/// @brief Global instance of the UiAo
extern UiAo* const the_AO_Ui;

#endif  // UI_AO_H